package com.kate.cloud.shiro.service.impl;

import com.kate.cloud.shiro.dao.JzUserMapper;
import com.kate.cloud.shiro.dto.UserDTO;
import com.kate.cloud.shiro.entity.JzUser;
import com.kate.cloud.shiro.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 李金照 on 2017/12/13.
 *
 * @author 金照
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private JzUserMapper userMapper;

    @Override
    public JzUser selectUser(String id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int createUser(UserDTO userDTO) {
        JzUser user = new JzUser();
        BeanUtils.copyProperties(userDTO,user);
        return userMapper.insert(user);
    }

    @Override
    public int deleteUser(String id) {
        return userMapper.deleteByPrimaryKey(id);
    }


}
